/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pneuservis.backend.to;

import java.math.BigDecimal;
import pneuservis.backend.entities.ServicePneu;

/**
 *
 * @author Admin
 */
public class ServicePneuTO {
    
    private Long id;
    private String name;
    private BigDecimal price;

    public ServicePneuTO() {
    }

    public ServicePneuTO(ServicePneu servicePneu) {
        if (servicePneu == null) {
            throw new IllegalArgumentException();
        }
        this.id = servicePneu.getId();
        this.name = servicePneu.getName();
        this.price = servicePneu.getPrice();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }
    
    public ServicePneu toServicePneu() {
        ServicePneu servicePneu = new ServicePneu();
        servicePneu.setId(id);
        servicePneu.setName(name);
        servicePneu.setPrice(price);
        return servicePneu;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ServicePneuTO other = (ServicePneuTO) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ServicePneuTO{" + "id=" + id + '}';
    }
}
